{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">人</span>
                    <h5>今日</h5>
                </div>
                <div class="ibox-content" style="display:flex;">
                    <div>
                        <h1 class="no-margins" >{$partneradd['today_num'] ? $partneradd['today_num'] : 0}</h1>
                        <small>今日新增</small>
                    </div>
                    <div style="margin-left: 62px;">
                        <div>推广合伙人：<span>{$partneradd['today_tui_num'] ? $partneradd['today_tui_num'] : 0}</span></div>
                        <div>事业合伙人：<span>{$partneradd['today_shi_num'] ? $partneradd['today_shi_num'] : 0}</span></div>
                        <div>城市合伙人：<span>{$partneradd['today_city_num'] ? $partneradd['today_city_num'] : 0}</span></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">人</span>
                    <h5>昨日</h5>
                </div>
                <div class="ibox-content" style="display:flex;">
                    <div>
                        <h1 class="no-margins" >{$partneradd['yesterday_num'] ? $partneradd['yesterday_num'] : 0}</h1>
                        <small>昨日新增</small>
                    </div>
                    <div style="margin-left: 62px;">
                        <div>推广合伙人：<span>{$partneradd['yesterday_tui_num'] ? $partneradd['yesterday_tui_num'] : 0}</span></div>
                        <div>事业合伙人：<span>{$partneradd['yesterday_shi_num'] ? $partneradd['yesterday_shi_num'] : 0}</span></div>
                        <div>城市合伙人：<span>{$partneradd['yesterday_city_num'] ? $partneradd['yesterday_city_num'] : 0}</span></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">人</span>
                    <h5>本月</h5>
                </div>
                <div class="ibox-content" style="display:flex;">
                    <div>
                        <h1 class="no-margins" >{$partneradd['thismonth_num'] ? $partneradd['thismonth_num'] : 0}</h1>
                        <small>本月新增</small>
                    </div>
                    <div style="margin-left: 62px;">
                        <div>推广合伙人：<span>{$partneradd['thismonth_tui_num'] ? $partneradd['thismonth_tui_num'] : 0}</span></div>
                        <div>事业合伙人：<span>{$partneradd['thismonth_shi_num'] ? $partneradd['thismonth_shi_num'] : 0}</span></div>
                        <div>城市合伙人：<span>{$partneradd['thismonth_city_num'] ? $partneradd['thismonth_city_num'] : 0}</span></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">人</span>
                    <h5>上月</h5>
                </div>
                <div class="ibox-content" style="display:flex;">
                    <div>
                        <h1 class="no-margins" >{$partneradd['lastmonth_num'] ? $partneradd['lastmonth_num'] : 0}</h1>
                        <small>上月新增</small>
                    </div>
                    <div style="margin-left: 62px;">
                        <div>推广合伙人：<span>{$partneradd['lastmonth_tui_num'] ? $partneradd['lastmonth_tui_num'] :0}</span></div>
                        <div>事业合伙人：<span>{$partneradd['lastmonth_shi_num'] ? $partneradd['lastmonth_shi_num'] :0}</span></div>
                        <div>城市合伙人：<span>{$partneradd['lastmonth_city_num'] ? $partneradd['lastmonth_city_num'] :0}</span></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item demoTable">
                        {if condition="empty($qu)"}
                        <div class="layui-input-inline layui-form">
                            <select name="role" lay-search="">
                                <option  value="">不限城市</option>
                                {foreach name="partner_city" item="vo")}
                                    <option  value="{$vo.district_id}">{$vo.district}</option>
                                {/foreach}
                            </select>
                        </div>
                        {/if}
                        <div class="layui-input-inline layui-form">
                            <select name="user_m_open" lay-search="">
                                <option  value="">不限产品池开启状态</option>
                                <option  value="1">没有开启</option>
                                <option  value="2">已开启</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="手机号"/>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <!--图片模板-->
                    <script type="text/html" id="imgTpl">
                        <img src="{{d.user_image}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                    </script>
                    
                    <script type="text/html" id="typeTpl">
                        {{# if(d.user_partner_type == 1){ }}
                        支付宝
                        {{# }else{ }}
                        微信
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a class="btn layui-btn layui-btn-xs" lay-event="earnings">推广收益</a>
                        <a class="btn layui-btn layui-btn-xs" lay-event="details">邀请详情</a>
                        {{#  if(d.user_m_open2 == 2){ }}
                        <a href="javascript:;" onclick="wk.layer_show('小店基础信息', '{:url('seeInfo')}?user_id={{d.par_user_id}}')" class="btn btn-warning btn-xs m-r-xs" title="小店基础信息">小店信息</a>
                        {{#  } }}
                    </script>
                    <script type="text/html" id="partner_level">
                    {{#  if(d.par_class_level == 1){ }}
                        <span>推广合伙人</span>
                    {{#  } else if(d.par_class_level == 2) { }}
                        <span>事业合伙人</span>
                    {{#  } else if(d.par_class_level == 3) { }}
                        <span>城市合伙人</span>
                      {{#  } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("admin/Partners/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 50, title: '序号'}
                , {field: 'user_image',width: '100', title: '头像', align: 'center', toolbar: '#imgTpl'}
                , {field: 'user_phone',width: '120', title: '手机号', align: 'center'}
                , {field: 'par_class_level',width: '100', title: '合伙人类型', align: 'center',templet:'#partner_level'}
                , {field: 'user_username',width: '100', title: '用户名', align: 'center'}
                , {field: 'total_balance', width: '100', title: '收益', align: 'center'}
                , {field: 'district', width: '80', title: '归属地', align: 'center'}
                , {field: 'shop_name', width: '100', title: '店铺名称', align: 'center'}
                , {field: 'par_add_time', width: '120', title: '加入时间', align: 'center'}
                , {field: 'user_partner_type', width: '100', title: '缴费方式', align: 'center', toolbar: '#typeTpl'}
                , {field: 'partner_parent_name', width: '100', title: '上级合伙人', align: 'center'}
                , {field: 'partner_parent_phone', width: '100', title: '上级合伙人手机', align: 'center'}
                , {field: 'user_m_open', width: '100', title: '是否开启产品池小店', align: 'center'}
                , {field: 'user_m_open_time', width: '100', title: '开启时间', align: 'center'}
                , {field: 'user_m_pool_money', width: '100', title: '产品池可提现余额', align: 'center'}
                , {fixed: 'right', width: '250', title: '操作', align: 'center', toolbar: '#opeBar'}
            ]],
            done: function (res, curr, count) {
                $('.img-circle').viewer();
            }
        });

        //监控页面追加的 修改删除
        table.on('tool(demo)', function(obj){
            var data = obj.data;
             switch(obj.event){
                case 'details':
                    // var sonlist =  layer.open({
                    //     type:2,
                    //     area:['1000px','600px'],
                    //     fixed:false,
                    //     maxmin:true,
                    //     shadeClose:true,
                    //     content:"/index.php/user/Partnerad/messageadd/id/"+id+"/m_id/"+data.id,
                    // })
                    //查看分销合伙人下级
                    location.href = "{:url('Partners/partnerchild')}?par_id="+data.par_id;
                break;
                case 'earnings':
                    //合伙人收益详情
                    location.href = "{:url('Partners/earnings')}?par_id="+data.par_id;
                break;
              };
        });
    });
    function check(o_id) {
        layer.confirm('提现审核是否通过?', {
            icon: 3,
            title:'提示',
            btn: ['通过', '驳回'],
            btn2:function(index){
                send(o_id,4);
                layer.close(index);
            }}, function(index){
            send(o_id,2);
            layer.close(index);
        });
    }
    function send(o_id,type){
        $.ajax({
            url: "{:url('tixian')}",
            type: "post",
            dataType: "json",
            data: {o_id:o_id,type:type},
            success: function (res) {
                if(res.code == 200){
                    layer.msg(res.msg,{icon:1,time:1500,shade: 0.1},function(){
                        //重载当前页表格
                        $(".layui-laypage-btn").click();
                    });
                } else if (res.code == 100){
                    layer.msg(res.msg,{icon:2,time:1500,shade: 0.1},function () {
                        //重载当前页表格
                        $(".layui-laypage-btn").click();
                    });
                }
            }
        });
    }
</script>
</body>
</html>